socsvn commit: r238979 - soc2012/oleksandr/udf-head/sbin/mount_udf2

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Wed Jul 4 22:47:18 UTC 2012


Author: oleksandr
Date: Wed Jul  4 22:47:14 2012
New Revision: 238979
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238979

Log:
  remove unused function, add new option to mount_udf2 -g,u,c, correct Makefile and add man page for mount_udf2

Modified:
  soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile
  soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c

Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile
==============================================================================
--- soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile	Wed Jul  4 20:59:30 2012	(r238978)
+++ soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile	Wed Jul  4 22:47:14 2012	(r238979)
@@ -2,13 +2,13 @@
 
 PROG=	mount_udf2
 SRCS=	mount_udf.c getmntopts.c
-MAN=	mount_udf.8
+MAN=	mount_udf2.8
 DPADD=	${LIBKICONV}
 LDADD=	-lkiconv
 
-#MOUNT=	${.CURDIR}/../mount
-#CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys
-#.PATH:	${MOUNT}
+MOUNT=	${.CURDIR}/../mount
+CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys
+.PATH:	${MOUNT}
 WARNS?= 1
 
 # Needs to be dynamically linked for optional dlopen() access to

Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c
==============================================================================
--- soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c	Wed Jul  4 20:59:30 2012	(r238978)
+++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c	Wed Jul  4 22:47:14 2012	(r238979)
@@ -2,6 +2,7 @@
  * Copyright (c) 1992, 1993, 1994
  *      The Regents of the University of California.  All rights reserved.
  * Copyright (c) 2002 Scott Long
+ * Copyright (c) 2012 Oleksandr Dudinskyi
  *
  * This code is derived from software contributed to Berkeley
  * by Pace Willisson (pace at blitz.com).  The Rock Ridge Extension
@@ -52,6 +53,7 @@
 #include <sys/ioctl.h>
 #include <sys/udfio.h>
 
+#include "fs/udf2/udf_mount.h"
 
 #include <err.h>
 #include <errno.h>
@@ -63,7 +65,6 @@
 #include <fcntl.h>
 
 #include "mntopts.h"
-#include "udf2/udf_mount.h"
 
 
 struct mntopt mopts[] = {
@@ -73,28 +74,39 @@
 };
 
 static int set_charset(char **, char **, const char *);
-//static void getlastblock(char *dev, struct udf_session_info *usi, 
-//   			 int session_num);
 static void usage(void);
-//static void print_session_info(char *dev, int session_num);
 
 int
 main(int argc, char **argv)
 {
-	struct udf_session_info usi;
-	struct iovec iov[18];
-	long session_num;
-	int ch, i, mntflags, opts, udf_flags, sessioninfo, verbose;
-	int32_t first_trackblank;
+	struct udf_args args;
+	struct iovec iov[14];
+	int ch, i, mntflags, opts, udf_flags, verbose;
 	char *dev, *dir, mntpath[MAXPATHLEN], *cs_disk, *cs_local, *endp;
 
-	session_num = 0;
-	sessioninfo = 0;
+	/* read in disk info from options */
+	args.anon_uid = 0;
+	args.anon_gid = 0;
+	args.nobody_uid = -1;
+	args.nobody_gid = -1;
 
 	i = mntflags = opts = udf_flags = verbose = 0;
 	cs_disk = cs_local = NULL;
-	while ((ch = getopt(argc, argv, "o:vC:s:p")) != -1)
+	while ((ch = getopt(argc, argv, "o:vC:s:c:g:u:")) != -1)
 		switch (ch) {
+		case 'c':
+			args.udfmflags |= UDFMNT_CLOSESESSION;			
+			break;
+		case 'g':
+			args.anon_gid = strtol(optarg, &endp, 10);
+			if (optarg == endp || *endp != '\0')
+				usage();	
+			break; 
+		case 'u':
+			args.anon_uid = strtol(optarg, &endp, 10);
+			if (optarg == endp || *endp != '\0')
+				usage();	
+			break; 
 		case 'o':
 			getmntopts(optarg, mopts, &mntflags, &opts);
 			break;
@@ -107,13 +119,10 @@
 			udf_flags |= UDFMNT_KICONV;
 			break;
 		case 's':
-			session_num = strtol(optarg, &endp, 10);
+			args.sessionnr = strtol(optarg, &endp, 10);
 			if (optarg == endp || *endp != '\0')
 				usage();	
 			break;
-		/*case 'p':
-			sessioninfo = 1;	
-			break; */
 		case '?':
 		default:
 			usage();
@@ -121,13 +130,6 @@
 	argc -= optind;
 	argv += optind;
 
-#if 0	
-	if (sessioninfo) {
-		if (argc != 1)
-			usage();
-		print_session_info(argv[0], session_num);
-	}
-#endif
 	if (argc != 2)
 		usage();
 
@@ -143,11 +145,6 @@
 	(void)rmslashes(dev, dev);
 
 	/*
-	 * Get session info from device
-	 */
-/*	getlastblock(dev, &usi, session_num); */
-
-	/*
 	 * UDF file systems are not writeable.
 	 */
 	mntflags |= MNT_RDONLY;
@@ -173,23 +170,10 @@
 	iov[i].iov_base = &udf_flags;
 	iov[i++].iov_len = sizeof(udf_flags);
 
-#if 0
-	iov[i].iov_base = "first_trackblank";
-	iov[i++].iov_len = sizeof("first_trackblank");
-	first_trackblank = 0;
-	iov[i].iov_base = &first_trackblank;
-	iov[i++].iov_len = sizeof(uint32_t);
-
-	iov[i].iov_base = "session_start_addr";
-	iov[i++].iov_len = sizeof("session_start_addr");
-	iov[i].iov_base = &usi.session_start_addr;
-	iov[i++].iov_len = sizeof(uint32_t);
-
-	iov[i].iov_base = "session_end_addr";
-	iov[i++].iov_len = sizeof("session_end_addr");
-	iov[i].iov_base = &usi.session_end_addr;
-	iov[i++].iov_len = sizeof(uint32_t);
-#endif	
+	iov[i].iov_base = "udf_args";
+	iov[i++].iov_len = sizeof("udf_args");
+	iov[i].iov_base = &args;
+	iov[i++].iov_len = sizeof(args);
 
 	if (udf_flags & UDFMNT_KICONV) {
 		iov[i].iov_base = "cs_disk";
@@ -230,59 +214,11 @@
 	return (0);
 }
 
-#if 0
-static void
-getlastblock(char *dev, struct udf_session_info *usi, int session_num)
-{
-	int fd, error;
-	unsigned int out;
-	fd = open(dev, O_RDONLY, 0);
-
-	if (fd < 0)
-		err(1, "open");
-
-	bzero(usi, sizeof(struct udf_session_info));
-	usi->session_num = session_num;
-	error = ioctl(fd, UDFIOTEST, usi);
-	if (error != 0) {
-		if (session_num == 0)
-			warn("This device not not support sessions");
-		else
-			err(2, "This device does not support sessions");
-	}
-
-	close(fd);
-}
-
-static void
-print_session_info(char *dev, int session_num) 
-{
-	struct udf_session_info usi;
-
-	rmslashes(dev, dev);
-	getlastblock(dev, &usi, session_num);
-
-
-	printf("session_num: %u\n", usi.session_num);
-	
-	printf("sector_size: %u\n", usi.sector_size);
-	printf("num_sessions: %u\n", usi.num_sessions);
-	printf("session_start_addr: %u\n", usi.session_start_addr);
-	printf("session_end_addr: %u\n", usi.session_end_addr);
-	
-	printf("num_tracks: %u\n", usi.num_tracks);
-	printf("first_track: %u\n", usi.first_track);
-	printf("session_first_track: %u\n", usi.session_first_track);
-	printf("session_last_track: %u\n", usi.session_last_track);
-
-	exit(0);
-}
-#endif
-
 static void
 usage(void)
 {
 	(void)fprintf(stderr,
-		"usage: mount_udf [-v] [-o options] [-C charset] [-s session] [-p] special node\n");
+		"usage: mount_udf2 [-v] [-o options] [-C charset] [-s session] "
+		"[-g gid] [-u uid] special node\n");
 	exit(EX_USAGE);
 }


More information about the svn-soc-all mailing list