コード例 #1
0
ファイル: mdc_lib.c プロジェクト: mikuhatsune001/linux2.6.32
static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
				 struct md_op_data *op_data)
{
	rec->sa_opcode  = REINT_SETATTR;
	rec->sa_fsuid   = from_kuid(&init_user_ns, current_fsuid());
	rec->sa_fsgid   = from_kgid(&init_user_ns, current_fsgid());
	rec->sa_cap     = cfs_curproc_cap_pack();
	rec->sa_suppgid = -1;

	rec->sa_fid    = op_data->op_fid1;
	rec->sa_valid  = attr_pack(op_data->op_attr.ia_valid);
	rec->sa_mode   = op_data->op_attr.ia_mode;
	rec->sa_uid    = from_kuid(&init_user_ns, op_data->op_attr.ia_uid);
	rec->sa_gid    = from_kgid(&init_user_ns, op_data->op_attr.ia_gid);
	rec->sa_size   = op_data->op_attr.ia_size;
	rec->sa_blocks = op_data->op_attr_blocks;
	rec->sa_atime  = LTIME_S(op_data->op_attr.ia_atime);
	rec->sa_mtime  = LTIME_S(op_data->op_attr.ia_mtime);
	rec->sa_ctime  = LTIME_S(op_data->op_attr.ia_ctime);
	rec->sa_attr_flags = ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
	if ((op_data->op_attr.ia_valid & ATTR_GID) &&
	    in_group_p(op_data->op_attr.ia_gid))
		rec->sa_suppgid =
			from_kgid(&init_user_ns, op_data->op_attr.ia_gid);
	else
		rec->sa_suppgid = op_data->op_suppgids[0];

	rec->sa_bias = op_data->op_bias;
}
コード例 #2
0
ファイル: mdc_lib.c プロジェクト: mikuhatsune001/linux2.6.32
static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
{
	LASSERT (b != NULL);

	b->suppgid = suppgid;
	b->uid = from_kuid(&init_user_ns, current_uid());
	b->gid = from_kgid(&init_user_ns, current_gid());
	b->fsuid = from_kuid(&init_user_ns, current_fsuid());
	b->fsgid = from_kgid(&init_user_ns, current_fsgid());
	b->capability = cfs_curproc_cap_pack();
}
コード例 #3
0
ファイル: mdc_lib.c プロジェクト: Xyratex/lustre-stable
/* packing of MDS records */
void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
		   umode_t mode, __u64 rdev, __u64 flags, const void *lmm,
		   size_t lmmlen)
{
	struct mdt_rec_create *rec;
	char *tmp;
	__u64 cr_flags;

	CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_create));
	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);

	/* XXX do something about time, uid, gid */
	rec->cr_opcode = REINT_OPEN;
	rec->cr_fsuid	= from_kuid(&init_user_ns, current_fsuid());
	rec->cr_fsgid	= from_kgid(&init_user_ns, current_fsgid());
	rec->cr_cap    = cfs_curproc_cap_pack();
	rec->cr_mode   = mode;
	cr_flags	= mds_pack_open_flags(flags);
	rec->cr_rdev   = rdev;
	rec->cr_umask  = current_umask();
	if (op_data != NULL) {
		rec->cr_fid1       = op_data->op_fid1;
		rec->cr_fid2       = op_data->op_fid2;
		rec->cr_time       = op_data->op_mod_time;
		rec->cr_suppgid1   = op_data->op_suppgids[0];
		rec->cr_suppgid2   = op_data->op_suppgids[1];
		rec->cr_bias       = op_data->op_bias;
		rec->cr_open_handle_old = op_data->op_open_handle;

		if (op_data->op_name) {
			mdc_pack_name(req, &RMF_NAME, op_data->op_name,
				      op_data->op_namelen);

			if (op_data->op_bias & MDS_CREATE_VOLATILE)
				cr_flags |= MDS_OPEN_VOLATILE;
		}

		mdc_file_secctx_pack(req, op_data->op_file_secctx_name,
				     op_data->op_file_secctx,
				     op_data->op_file_secctx_size);

		/* pack SELinux policy info if any */
		mdc_file_sepol_pack(req);
	}

	if (lmm) {
		cr_flags |= MDS_OPEN_HAS_EA;
		tmp = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
		memcpy(tmp, lmm, lmmlen);
	}
	set_mrc_cr_flags(rec, cr_flags);
}
コード例 #4
0
ファイル: mdc_lib.c プロジェクト: Zealsathish/lustre
/* packing of MDS records */
void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
		   umode_t mode, __u64 rdev, __u64 flags, const void *lmm,
		   size_t lmmlen)
{
	struct mdt_rec_create *rec;
	char *tmp;
	__u64 cr_flags;

	CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_create));
	rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);

	/* XXX do something about time, uid, gid */
	rec->cr_opcode = REINT_OPEN;
	rec->cr_fsuid	= from_kuid(&init_user_ns, current_fsuid());
	rec->cr_fsgid	= from_kgid(&init_user_ns, current_fsgid());
	rec->cr_cap    = cfs_curproc_cap_pack();
	rec->cr_mode   = mode;
	cr_flags	= mds_pack_open_flags(flags);
	rec->cr_rdev   = rdev;
	rec->cr_umask  = current_umask();
	if (op_data != NULL) {
		rec->cr_fid1       = op_data->op_fid1;
		rec->cr_fid2       = op_data->op_fid2;
		rec->cr_time       = op_data->op_mod_time;
		rec->cr_suppgid1   = op_data->op_suppgids[0];
		rec->cr_suppgid2   = op_data->op_suppgids[1];
		rec->cr_bias       = op_data->op_bias;
		rec->cr_old_handle = op_data->op_handle;

		mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
		/* the next buffer is child capa, which is used for replay,
		 * will be packed from the data in reply message. */

		if (op_data->op_name) {
			mdc_pack_name(req, &RMF_NAME, op_data->op_name,
				      op_data->op_namelen);

			if (op_data->op_bias & MDS_CREATE_VOLATILE)
				cr_flags |= MDS_OPEN_VOLATILE;
		}
	}

	if (lmm) {
		cr_flags |= MDS_OPEN_HAS_EA;
		tmp = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
		memcpy(tmp, lmm, lmmlen);
	}
	set_mrc_cr_flags(rec, cr_flags);
}