X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_nrs_tbf.h;h=0a407197c36f65aea05d9fe74e761ae64b3b94c3;hb=5222ba07e3bd087ddb0812e2185610b725cb9d1a;hp=7da07fb0442fe4735a60ddbaf129cb4ffdcb75ef;hpb=d11fa2c279593634cf6c4196b413a6d285b24e10;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_nrs_tbf.h b/lustre/include/lustre_nrs_tbf.h index 7da07fb..0a40719 100644 --- a/lustre/include/lustre_nrs_tbf.h +++ b/lustre/include/lustre_nrs_tbf.h @@ -51,7 +51,31 @@ struct nrs_tbf_jobid { struct list_head tj_linkage; }; -#define NRS_TBF_KEY_LEN (LNET_NIDSTR_SIZE + LUSTRE_JOBID_SIZE + 3 + 2) +#define MAX_U32_STR_LEN 10 +#define NRS_TBF_KEY_LEN (LNET_NIDSTR_SIZE + LUSTRE_JOBID_SIZE + \ + MAX_U32_STR_LEN + MAX_U32_STR_LEN + 3 + 2) + +enum nrs_tbf_flag { + NRS_TBF_FLAG_INVALID = 0x0000000, + NRS_TBF_FLAG_JOBID = 0x0000001, + NRS_TBF_FLAG_NID = 0x0000002, + NRS_TBF_FLAG_OPCODE = 0x0000004, + NRS_TBF_FLAG_GENERIC = 0x0000008, + NRS_TBF_FLAG_UID = 0x0000010, + NRS_TBF_FLAG_GID = 0x0000020, +}; + +struct tbf_id { + enum nrs_tbf_flag ti_type; + u32 ti_uid; + u32 ti_gid; +}; + +struct nrs_tbf_id { + struct tbf_id nti_id; + struct list_head nti_linkage; +}; + struct nrs_tbf_client { /** Resource object for policy instance. */ struct ptlrpc_nrs_resource tc_res; @@ -63,6 +87,8 @@ struct nrs_tbf_client { char tc_jobid[LUSTRE_JOBID_SIZE]; /** opcode of the client. */ __u32 tc_opcode; + /** gid or uid of the client. */ + struct tbf_id tc_id; /** Hash key of the client. */ char tc_key[NRS_TBF_KEY_LEN]; /** Reference number of the client. */ @@ -130,6 +156,10 @@ struct nrs_tbf_rule { struct list_head tr_jobids; /** Jobid list string of the rule.*/ char *tr_jobids_str; + /** uid/gid list of the rule. */ + struct list_head tr_ids; + /** uid/gid list string of the rule. */ + char *tr_ids_str; /** Opcode bitmap of the rule. */ struct cfs_bitmap *tr_opcodes; /** Opcode list string of the rule.*/ @@ -178,16 +208,10 @@ struct nrs_tbf_ops { #define NRS_TBF_TYPE_NID "nid" #define NRS_TBF_TYPE_OPCODE "opcode" #define NRS_TBF_TYPE_GENERIC "generic" +#define NRS_TBF_TYPE_UID "uid" +#define NRS_TBF_TYPE_GID "gid" #define NRS_TBF_TYPE_MAX_LEN 20 -enum nrs_tbf_flag { - NRS_TBF_FLAG_INVALID = 0x0000000, - NRS_TBF_FLAG_JOBID = 0x0000001, - NRS_TBF_FLAG_NID = 0x0000002, - NRS_TBF_FLAG_OPCODE = 0x0000004, - NRS_TBF_FLAG_GENERIC = 0x0000008, -}; - struct nrs_tbf_type { const char *ntt_name; enum nrs_tbf_flag ntt_flag; @@ -280,6 +304,8 @@ struct nrs_tbf_cmd { char *ts_nids_str; struct list_head ts_jobids; char *ts_jobids_str; + struct list_head ts_ids; + char *ts_ids_str; struct cfs_bitmap *ts_opcodes; char *ts_opcodes_str; struct list_head ts_conds; @@ -299,6 +325,8 @@ enum nrs_tbf_field { NRS_TBF_FIELD_NID, NRS_TBF_FIELD_JOBID, NRS_TBF_FIELD_OPCODE, + NRS_TBF_FIELD_UID, + NRS_TBF_FIELD_GID, NRS_TBF_FIELD_MAX };