示例#1
0
def _mirror_stat_data(posixfn, lindfn):
  # internal function to take a lind filename (or dirname, etc.) and change
  # it to have similar metadata to a posixfn.   This includes perms, uid, gid

  statdata = os.stat(posixfn)
  
  # I only want the file perms, not things like 'IS_DIR'.  
  # BUG (?): I think this ignores SETUID, SETGID, sticky bit, etc.
  lind_test_server.chmod_syscall(lindfn, S_IRWXA & statdata[0])
def _mirror_stat_data(posixfn, lindfn):
  # internal function to take a lind filename (or dirname, etc.) and change
  # it to have similar metadata to a posixfn.   This includes perms, uid, gid

  statdata = os.stat(posixfn)
  
  # I only want the file perms, not things like 'IS_DIR'.  
  # BUG (?): I think this ignores SETUID, SETGID, sticky bit, etc.
  lind_test_server.chmod_syscall(lindfn, S_IRWXA & statdata[0])
示例#3
0
 def chmod(self, path, mode):
     log("chmod", path, hex(mode))
     try:
         ret = lind.chmod_syscall(path, mode)
     except lind.SyscallError, e:
         ret = -errno[e[1]]
示例#4
0
 def chmod(self, path, mode):
     log("chmod", path, hex(mode))
     try:
         ret = lind.chmod_syscall(path, mode)
     except lind.SyscallError, e:
         ret = -errno[e[1]]
示例#5
0
import lind_test_server

from lind_fs_constants import *

# Let's add a few files, etc. to the system and see if it works...
lind_test_server._blank_fs_init()

filefd = lind_test_server.open_syscall('/foo',O_CREAT | O_EXCL | O_WRONLY,\
  S_IRWXA)

assert lind_test_server.stat_syscall('/foo')[2] == S_IRWXA | S_IFREG, \
  "Failed to have full access to all users."

lind_test_server.chmod_syscall('/foo', S_IRUSR | S_IRGRP)

assert lind_test_server.stat_syscall('/foo')[2] == S_IRUSR | S_IRGRP | S_IFREG\
  , "Failed to set Read access to user and group."

lind_test_server.chmod_syscall('/foo', S_IRWXA)

assert lind_test_server.stat_syscall('/foo')[2] == S_IRWXA | S_IFREG, \
  "Failed to set back full access to all users."

lind_test_server.close_syscall(filefd)