Skip to content

Commit

Permalink
1120 Use real file descriptors for smbfs named pipes.
Browse files Browse the repository at this point in the history
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Garrett D'Amore <garrett@nexenta.com>
  • Loading branch information
gwr committed Jun 30, 2011
1 parent 9ecc761 commit 430b4c4
Show file tree
Hide file tree
Showing 40 changed files with 1,713 additions and 765 deletions.
6 changes: 4 additions & 2 deletions exception_lists/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#
# CDDL HEADER END
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2010 Nexenta Systems, Inc. All rights reserved.
#

syntax: glob
Expand Down Expand Up @@ -48,6 +48,7 @@ usr/src/cmd/krb5/ldap_util/kdb5_ldap_list.h
usr/src/cmd/krb5/ldap_util/kdb5_ldap_policy.h
usr/src/cmd/krb5/ldap_util/kdb5_ldap_realm.h
usr/src/cmd/krb5/ldap_util/kdb5_ldap_services.h
usr/src/cmd/smbsrv/smbd/eventlog.dll
usr/src/common/bzip2/LICENSE
usr/src/common/bzip2/Solaris.README.txt
usr/src/common/bzip2/bzlib.h
Expand Down Expand Up @@ -328,6 +329,7 @@ usr/src/lib/krb5/ss/utils.c
usr/src/lib/libkmsagent/common/SOAP/*.*
usr/src/lib/librstp/common/*.[ch]
usr/src/lib/librstp/common/[CRT]*
usr/src/uts/intel/nsmb/ioc_check.ref
usr/src/uts/intel/os/splashimage.xpm
usr/src/uts/common/gssapi/mechs/krb5/crypto/block_size.c
usr/src/uts/common/gssapi/mechs/krb5/crypto/checksum_length.c
Expand All @@ -354,4 +356,4 @@ usr/src/uts/common/gssapi/mechs/krb5/krb5/os/toffset.c
usr/src/uts/common/gssapi/mechs/krb5/mech/util_seed.c
usr/src/uts/common/gssapi/mechs/krb5/mech/util_seqnum.c
usr/src/uts/common/gssapi/mechs/krb5/mech/val_cred.c
usr/src/cmd/smbsrv/smbd/eventlog.dll
usr/src/uts/sparc/nsmb/ioc_check.ref
1 change: 1 addition & 0 deletions exception_lists/packaging
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ usr/lib/sparcv9/llib-lsmbfs.ln sparc
#
usr/lib/fs/smbfs/chacl
usr/lib/fs/smbfs/lsacl
usr/lib/fs/smbfs/testnp
#
# FC related files
kernel/kmdb/fcip i386
Expand Down
3 changes: 2 additions & 1 deletion usr/src/cmd/fs.d/smbclnt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#

#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#

Expand All @@ -32,7 +33,7 @@ include $(SRC)/Makefile.master

SUBDIRS_CATALOG= smbutil mount umount share
SUBDIRS= $(SUBDIRS_CATALOG) chacl lsacl \
smbiod smbiod-svc svc
smbiod smbiod-svc svc test

# for messaging catalog files
#
Expand Down
17 changes: 10 additions & 7 deletions usr/src/cmd/fs.d/smbclnt/smbutil/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/

/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
Expand Down Expand Up @@ -150,7 +151,7 @@ cmd_print(int argc, char *argv[])
* Have the printer share connection.
* Print the file.
*/
snprintf(titlebuf, sizeof (titlebuf), "%s_%s",
snprintf(titlebuf, sizeof (titlebuf), "%s %s",
ctx->ct_user, filename);

error = print_file(ctx, titlebuf, file);
Expand Down Expand Up @@ -185,13 +186,15 @@ static int
print_file(smb_ctx_t *ctx, char *title, int file)
{
off_t offset;
int error, rcnt, wcnt;
int rcnt, wcnt;
int setup_len = 0; /* No printer setup data */
int mode = MODE_GRAPHICS; /* treat as raw data */
int fh = -1;
int error = 0;
int pfd = -1;

error = smb_printer_open(ctx, setup_len, mode, title, &fh);
if (error) {
pfd = smb_open_printer(ctx, title, setup_len, mode);
if (pfd < 0) {
error = errno;
smb_error("could not open print job", error);
return (error);
}
Expand All @@ -207,7 +210,7 @@ print_file(smb_ctx_t *ctx, char *title, int file)
if (rcnt == 0)
break;

wcnt = smb_fh_write(ctx, fh, offset, rcnt, databuf);
wcnt = smb_fh_write(pfd, offset, rcnt, databuf);
if (wcnt < 0) {
error = errno;
smb_error("error writing spool file\n", error);
Expand All @@ -221,6 +224,6 @@ print_file(smb_ctx_t *ctx, char *title, int file)
offset += wcnt;
}

(void) smb_printer_close(ctx, fh);
(void) smb_fh_close(pfd);
return (error);
}
58 changes: 58 additions & 0 deletions usr/src/cmd/fs.d/smbclnt/test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#

FSTYPE= smbfs
LIBPROG= testnp
ROOTFS_PROG= $(LIBPROG)

include ../../Makefile.fstype

OBJS= $(LIBPROG).o
SRCS= $(LIBPROG).c $(FSLIBSRC)

LDLIBS += -lsmbfs

CFLAGS += $(CCVERBOSE)
C99MODE= $(C99_ENABLE)

CLOBBERFILES += $(LIBPROG)

# uncomment these for dbx debugging
#COPTFLAG = -g
#CTF_FLAGS =
#CTFCONVERT_O=
#CTFMERGE_LIB=

all: $(ROOTFS_PROG)

install: $(ROOTLIBFSTYPEPROG)

lint: lint_SRCS

clean:
$(RM) $(OBJS)

.KEEP_STATE:
Loading

0 comments on commit 430b4c4

Please sign in to comment.