Apply some const
authorvlendec <vlendec@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Fri, 5 Oct 2007 21:41:17 +0000 (21:41 +0000)
committervlendec <vlendec@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Fri, 5 Oct 2007 21:41:17 +0000 (21:41 +0000)
Why? It moves these structs from the data into the text segment, so they
will never been copy-on-write copied. Not much, but as in German you say
"Kleinvieh macht auch Mist...."

git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_3_2@25534 0c0555d6-39d7-0310-84fc-f1cc0bd64818

14 files changed:
source/include/rpc_secdes.h
source/lib/secdesc.c
source/lib/sharesec.c
source/lib/util_seaccess.c
source/printing/nt_printing.c
source/registry/reg_frontend_hilvl.c
source/rpc_server/srv_lsa_nt.c
source/rpc_server/srv_samr_nt.c
source/rpc_server/srv_spoolss_nt.c
source/rpc_server/srv_srvsvc_nt.c
source/rpc_server/srv_svcctl_nt.c
source/rpc_server/srv_winreg_nt.c
source/smbd/open.c
source/smbd/posix_acls.c

index 298d4e6..649e806 100644 (file)
@@ -108,19 +108,19 @@ typedef struct sec_desc_buf SEC_DESC_BUF;
 /* A type to describe the mapping of generic access rights to object
    specific access rights. */
 
-typedef struct generic_mapping {
+struct generic_mapping {
        uint32 generic_read;
        uint32 generic_write;
        uint32 generic_execute;
        uint32 generic_all;
-} GENERIC_MAPPING;
+};
 
-typedef struct standard_mapping {
+struct standard_mapping {
        uint32 std_read;
        uint32 std_write;
        uint32 std_execute;
        uint32 std_all;
-} STANDARD_MAPPING;
+};
 
 
 /* Security Access Masks Rights */
index 34954aa..99f5c0c 100644 (file)
@@ -24,7 +24,7 @@
 
 /* Map generic permissions to file object specific permissions */
 
-struct generic_mapping file_generic_mapping = {
+const struct generic_mapping file_generic_mapping = {
        FILE_GENERIC_READ,
        FILE_GENERIC_WRITE,
        FILE_GENERIC_EXECUTE,
index 0363055..d30ccbe 100644 (file)
@@ -29,7 +29,7 @@ static TDB_CONTEXT *share_tdb; /* used for share security descriptors */
 
 /* Map generic permissions to file object specific permissions */
 
-static struct generic_mapping file_generic_mapping = {
+static const struct generic_mapping file_generic_mapping = {
         FILE_GENERIC_READ,
         FILE_GENERIC_WRITE,
         FILE_GENERIC_EXECUTE,
index f725656..8d49ea2 100644 (file)
@@ -146,7 +146,7 @@ static BOOL get_max_access( SEC_ACL *the_acl, const NT_USER_TOKEN *token, uint32
    objects.  Each type of object has its own mapping of generic to object
    specific access rights. */
 
-void se_map_generic(uint32 *access_mask, struct generic_mapping *mapping)
+void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping)
 {
        uint32 old_mask = *access_mask;
 
index cbd220d..5e7e2a4 100644 (file)
@@ -42,14 +42,14 @@ static TDB_CONTEXT *tdb_printers; /* used for printers files */
 
 /* Map generic permissions to printer object specific permissions */
 
-GENERIC_MAPPING printer_generic_mapping = {
+const struct generic_mapping printer_generic_mapping = {
        PRINTER_READ,
        PRINTER_WRITE,
        PRINTER_EXECUTE,
        PRINTER_ALL_ACCESS
 };
 
-STANDARD_MAPPING printer_std_mapping = {
+const struct standard_mapping printer_std_mapping = {
        PRINTER_READ,
        PRINTER_WRITE,
        PRINTER_EXECUTE,
@@ -58,14 +58,14 @@ STANDARD_MAPPING printer_std_mapping = {
 
 /* Map generic permissions to print server object specific permissions */
 
-GENERIC_MAPPING printserver_generic_mapping = {
+const struct generic_mapping printserver_generic_mapping = {
        SERVER_READ,
        SERVER_WRITE,
        SERVER_EXECUTE,
        SERVER_ALL_ACCESS
 };
 
-STANDARD_MAPPING printserver_std_mapping = {
+const struct generic_mapping printserver_std_mapping = {
        SERVER_READ,
        SERVER_WRITE,
        SERVER_EXECUTE,
index 4ed4093..de64beb 100644 (file)
@@ -28,7 +28,7 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
-static struct generic_mapping reg_generic_map = 
+static const struct generic_mapping reg_generic_map =
        { REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
 
 /********************************************************************
index 40d5005..4bd6a63 100644 (file)
@@ -39,7 +39,7 @@ struct lsa_info {
        uint32 access;
 };
 
-struct generic_mapping lsa_generic_mapping = {
+const struct generic_mapping lsa_generic_mapping = {
        POLICY_READ,
        POLICY_WRITE,
        POLICY_EXECUTE,
index 950a186..bec2887 100644 (file)
@@ -72,32 +72,32 @@ struct samr_info {
        TALLOC_CTX *mem_ctx;
 };
 
-static struct generic_mapping sam_generic_mapping = {
+static const struct generic_mapping sam_generic_mapping = {
        GENERIC_RIGHTS_SAM_READ,
        GENERIC_RIGHTS_SAM_WRITE,
        GENERIC_RIGHTS_SAM_EXECUTE,
        GENERIC_RIGHTS_SAM_ALL_ACCESS};
-static struct generic_mapping dom_generic_mapping = {
+static const struct generic_mapping dom_generic_mapping = {
        GENERIC_RIGHTS_DOMAIN_READ,
        GENERIC_RIGHTS_DOMAIN_WRITE,
        GENERIC_RIGHTS_DOMAIN_EXECUTE,
        GENERIC_RIGHTS_DOMAIN_ALL_ACCESS};
-static struct generic_mapping usr_generic_mapping = {
+static const struct generic_mapping usr_generic_mapping = {
        GENERIC_RIGHTS_USER_READ,
        GENERIC_RIGHTS_USER_WRITE,
        GENERIC_RIGHTS_USER_EXECUTE,
        GENERIC_RIGHTS_USER_ALL_ACCESS};
-static struct generic_mapping usr_nopwchange_generic_mapping = {
+static const struct generic_mapping usr_nopwchange_generic_mapping = {
        GENERIC_RIGHTS_USER_READ,
        GENERIC_RIGHTS_USER_WRITE,
        GENERIC_RIGHTS_USER_EXECUTE & ~SA_RIGHT_USER_CHANGE_PASSWORD,
        GENERIC_RIGHTS_USER_ALL_ACCESS};
-static struct generic_mapping grp_generic_mapping = {
+static const struct generic_mapping grp_generic_mapping = {
        GENERIC_RIGHTS_GROUP_READ,
        GENERIC_RIGHTS_GROUP_WRITE,
        GENERIC_RIGHTS_GROUP_EXECUTE,
        GENERIC_RIGHTS_GROUP_ALL_ACCESS};
-static struct generic_mapping ali_generic_mapping = {
+static const struct generic_mapping ali_generic_mapping = {
        GENERIC_RIGHTS_ALIAS_READ,
        GENERIC_RIGHTS_ALIAS_WRITE,
        GENERIC_RIGHTS_ALIAS_EXECUTE,
@@ -107,7 +107,7 @@ static struct generic_mapping ali_generic_mapping = {
 *******************************************************************/
 
 static NTSTATUS make_samr_object_sd( TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size,
-                                     struct generic_mapping *map,
+                                     const struct generic_mapping *map,
                                     DOM_SID *sid, uint32 sid_access )
 {
        DOM_SID domadmin_sid;
index f573d3f..d5795cc 100644 (file)
@@ -63,7 +63,7 @@ static uint32 smb_connections=0;
 
 /* in printing/nt_printing.c */
 
-extern STANDARD_MAPPING printer_std_mapping, printserver_std_mapping;
+extern struct standard_mapping printer_std_mapping, printserver_std_mapping;
 
 /* API table for Xcv Monitor functions */
 
index 503ecc1..321ff83 100644 (file)
@@ -27,7 +27,7 @@
 
 #define MAX_SERVER_DISK_ENTRIES 15
 
-extern struct generic_mapping file_generic_mapping;
+extern const struct generic_mapping file_generic_mapping;
 extern userdom_struct current_user_info;
 
 #undef DBGC_CLASS
index 6d807f3..dba209e 100644 (file)
@@ -49,9 +49,9 @@ extern SERVICE_CONTROL_OPS wins_svc_ops;
 
 struct service_control_op *svcctl_ops;
 
-static struct generic_mapping scm_generic_map =
+static const struct generic_mapping scm_generic_map =
        { SC_MANAGER_READ_ACCESS, SC_MANAGER_WRITE_ACCESS, SC_MANAGER_EXECUTE_ACCESS, SC_MANAGER_ALL_ACCESS };
-static struct generic_mapping svc_generic_map =
+static const struct generic_mapping svc_generic_map =
        { SERVICE_READ_ACCESS, SERVICE_WRITE_ACCESS, SERVICE_EXECUTE_ACCESS, SERVICE_ALL_ACCESS };
 
 
index fe3295e..2d6ff74 100644 (file)
@@ -26,7 +26,7 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
 
-static struct generic_mapping reg_generic_map = 
+static const struct generic_mapping reg_generic_map =
        { REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
 
 /******************************************************************
index 6c2b5a4..c2d7807 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "includes.h"
 
-extern struct generic_mapping file_generic_mapping;
+extern const struct generic_mapping file_generic_mapping;
 extern struct current_user current_user;
 extern userdom_struct current_user_info;
 extern BOOL global_client_failed_oplock_break;
index f7cadee..116917d 100644 (file)
@@ -21,7 +21,7 @@
 #include "includes.h"
 
 extern struct current_user current_user;
-extern struct generic_mapping file_generic_mapping;
+extern const struct generic_mapping file_generic_mapping;
 
 #undef  DBGC_CLASS
 #define DBGC_CLASS DBGC_ACLS