[Ocfs2-commits] manish commits r2104 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Sun Apr 3 14:19:15 CDT 2005


Author: manish
Signed-off-by: khackel
Date: 2005-04-03 14:19:13 -0500 (Sun, 03 Apr 2005)
New Revision: 2104

Modified:
   trunk/fs/ocfs2/symlink.c
Log:
Add uid, gid, and sys ({mach}_{os} effectively) cdsl types

Signed-off-by: khackel


Modified: trunk/fs/ocfs2/symlink.c
===================================================================
--- trunk/fs/ocfs2/symlink.c	2005-04-02 06:16:51 UTC (rev 2103)
+++ trunk/fs/ocfs2/symlink.c	2005-04-03 19:19:13 UTC (rev 2104)
@@ -28,8 +28,10 @@
  *
  *  Portions Copyright (C) 2001 Compaq Computer Corporation
  *
- *  ocfs symlink handling code
- *  for CDSL support
+ *  ocfs2 symlink handling code for CDSL support
+ *
+ *  Copyright (C) 2004, 2005 Oracle.
+ *  
  */
 
 #include "ocfs_compat.h"
@@ -137,27 +139,78 @@
 static unsigned int
 sym_nodenum(char *str, void *data)
 {
-	unsigned l;
+	unsigned int l;
 	char buf[10];
 	struct inode *inode = data;
 	ocfs_super *osb = OCFS_SB(inode->i_sb);
 
-	sprintf(buf,"%lu", (unsigned long)osb->node_num);
-	l = strlen(buf);
+	l = sprintf(buf, "%lu", (unsigned long)osb->node_num);
 
 	if (str) {
 	      memcpy(str, buf, l);
-	      str[l] ='\0';
+	      str[l] = '\0';
 	}
 
 	return l;
 }
 
+static unsigned int
+sym_system(char *str, void *data)
+{
+	unsigned int ml = strlen(system_utsname.machine);
+	unsigned int sl = strlen(system_utsname.sysname);
+	unsigned int l = ml + sl + 1;
+
+	if (str) {
+	       memcpy(str, system_utsname.machine, ml);
+	       str[ml] = '_';
+	       memcpy(str + ml + 1, system_utsname.sysname, sl);
+	       str[l] = '\0';
+	};
+
+	return l;
+}
+
+static unsigned int
+sym_uid(char *str, void *data)
+{
+	unsigned int l;
+	char buf[10];
+
+	l = sprintf(buf, "%lu", (unsigned long)current->fsuid);
+
+	if (str) {
+	      memcpy(str, buf, l);
+	      str[l] = '\0';
+	}
+
+	return l;
+}
+
+static unsigned int
+sym_gid(char *str, void *data)
+{
+	unsigned int l;
+	char buf[10];
+
+	l = sprintf(buf, "%lu", (unsigned long)current->fsgid);
+
+	if (str) {
+	      memcpy(str, buf, l);
+	      str[l] = '\0';
+	}
+
+	return l;
+}
+
 static struct ocfs_symlink_ops symlink_ops[] = {
 	{"hostname}", 9, sym_hostname},
 	{"mach}", 5, sym_machine},
 	{"os}", 3, sym_os},
 	{"nodenum}", 8, sym_nodenum},
+	{"sys}", 4, sym_system},
+	{"uid}", 4, sym_uid},
+	{"gid}", 4, sym_gid},
 	{NULL, 0, NULL}
 };
 



More information about the Ocfs2-commits mailing list