direct-io.hg

changeset 14614:14aeb7981e4e

merge with xen-unstable.hg
author awilliam@xenbuild2.aw
date Tue Mar 27 12:21:48 2007 -0600 (2007-03-27)
parents 2c59917255f7 10fcea8f51cd
children 0b2794d3320f cc0d9207cd34
files
line diff
     1.1 --- a/.hgignore	Tue Mar 27 09:07:51 2007 -0600
     1.2 +++ b/.hgignore	Tue Mar 27 12:21:48 2007 -0600
     1.3 @@ -18,6 +18,7 @@
     1.4  ^cscope.*$
     1.5  ^[^/]*\.bz2$
     1.6  ^\.config$
     1.7 +^\.pc
     1.8  ^TAGS$
     1.9  ^tags$
    1.10  ^build.*$
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 27 09:07:51 2007 -0600
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 27 12:21:48 2007 -0600
     2.3 @@ -556,7 +556,8 @@ class XendDomainInfo:
     2.4          return self.getDeviceController(deviceClass).destroyDevice(devid, force)
     2.5  
     2.6      def getDeviceSxprs(self, deviceClass):
     2.7 -        if self.state == DOM_STATE_RUNNING:
     2.8 +        if self.state == DOM_STATE_RUNNING \
     2.9 +               or self.state == DOM_STATE_PAUSED:
    2.10              return self.getDeviceController(deviceClass).sxprs()
    2.11          else:
    2.12              sxprs = []
    2.13 @@ -572,8 +573,8 @@ class XendDomainInfo:
    2.14          """Set the memory target of this domain.
    2.15          @param target: In MiB.
    2.16          """
    2.17 -        log.debug("Setting memory target of domain %s (%d) to %d MiB.",
    2.18 -                  self.info['name_label'], self.domid, target)
    2.19 +        log.debug("Setting memory target of domain %s (%s) to %d MiB.",
    2.20 +                  self.info['name_label'], str(self.domid), target)
    2.21          
    2.22          if target <= 0:
    2.23              raise XendError('Invalid memory size')
    2.24 @@ -585,29 +586,28 @@ class XendDomainInfo:
    2.25          if self.domid >= 0:
    2.26              self.storeVm("memory", target)
    2.27              self.storeDom("memory/target", target << 10)
    2.28 -        else:
    2.29 -            xen.xend.XendDomain.instance().managed_config_save(self)
    2.30 +        xen.xend.XendDomain.instance().managed_config_save(self)
    2.31  
    2.32      def setMemoryMaximum(self, limit):
    2.33          """Set the maximum memory limit of this domain
    2.34          @param limit: In MiB.
    2.35          """
    2.36 -        log.debug("Setting memory maximum of domain %s (%d) to %d MiB.",
    2.37 -                  self.info['name_label'], self.domid, limit)
    2.38 +        log.debug("Setting memory maximum of domain %s (%s) to %d MiB.",
    2.39 +                  self.info['name_label'], str(self.domid), limit)
    2.40  
    2.41          if limit <= 0:
    2.42              raise XendError('Invalid memory size')
    2.43  
    2.44 -        self.info['memory_static_max'] = limit
    2.45 +        MiB = 1024 * 1024
    2.46 +        self.info['memory_static_max'] = limit * MiB
    2.47 +
    2.48          if self.domid >= 0:
    2.49              maxmem = int(limit) * 1024
    2.50              try:
    2.51                  return xc.domain_setmaxmem(self.domid, maxmem)
    2.52              except Exception, ex:
    2.53                  raise XendError(str(ex))
    2.54 -        else:
    2.55 -            self.info['memory_dynamic_max'] = limit
    2.56 -            xen.xend.XendDomain.instance().managed_config_save(self)
    2.57 +        xen.xend.XendDomain.instance().managed_config_save(self)
    2.58  
    2.59  
    2.60      def getVCPUInfo(self):
    2.61 @@ -2302,8 +2302,8 @@ class XendDomainInfo:
    2.62          if not dev_uuid:
    2.63              raise XendError('Failed to create device')
    2.64  
    2.65 -        if self.state == XEN_API_VM_POWER_STATE_RUNNING:
    2.66 -            
    2.67 +        if self.state == XEN_API_VM_POWER_STATE_RUNNING or \
    2.68 +               self.state == XEN_API_VM_POWER_STATE_PAUSED:
    2.69              _, config = self.info['devices'][dev_uuid]
    2.70              
    2.71              if vdi_image_path.startswith('tap'):
    2.72 @@ -2409,7 +2409,8 @@ class XendDomainInfo:
    2.73              raise XendError('Device does not exist')
    2.74  
    2.75          try:
    2.76 -            if self.state == XEN_API_VM_POWER_STATE_RUNNING:
    2.77 +            if self.state == XEN_API_VM_POWER_STATE_RUNNING \
    2.78 +                   or self.state == XEN_API_VM_POWER_STATE_PAUSED:
    2.79                  _, config = self.info['devices'][dev_uuid]
    2.80                  devid = config.get('devid')
    2.81                  if devid != None:
     3.1 --- a/tools/security/python/xensec_gen/main.py	Tue Mar 27 09:07:51 2007 -0600
     3.2 +++ b/tools/security/python/xensec_gen/main.py	Tue Mar 27 12:21:48 2007 -0600
     3.3 @@ -39,147 +39,147 @@ gUser     = 'nobody'
     3.4  gGroup    = 'nobody'
     3.5  
     3.6  def usage( ):
     3.7 -	print >>sys.stderr, 'Usage:  ' + sys.argv[0] + ' [OPTIONS]'
     3.8 -	print >>sys.stderr, '  OPTIONS:'
     3.9 -	print >>sys.stderr, '  -p, --httpport'
    3.10 -	print >>sys.stderr, '     The port on which the http server is to listen'
    3.11 -	print >>sys.stderr, '     (default: ' + str( gHttpPort ) + ')'
    3.12 -	print >>sys.stderr, '  -d, --httpdir'
    3.13 -	print >>sys.stderr, '     The directory where the http server is to serve pages from'
    3.14 -	print >>sys.stderr, '     (default: ' + gHttpDir + ')'
    3.15 -	print >>sys.stderr, '  -l, --logfile'
    3.16 -	print >>sys.stderr, '     The file in which to log messages generated by this command'
    3.17 -	print >>sys.stderr, '     (default: ' + gLogFile + ')'
    3.18 -	print >>sys.stderr, '  -u, --user'
    3.19 -	print >>sys.stderr, '     The user under which this command is to run.  This parameter'
    3.20 -	print >>sys.stderr, '     is only used when invoked under the "root" user'
    3.21 -	print >>sys.stderr, '     (default: ' + gUser + ')'
    3.22 -	print >>sys.stderr, '  -g, --group'
    3.23 -	print >>sys.stderr, '     The group under which this command is to run.  This parameter'
    3.24 -	print >>sys.stderr, '     is only used when invoked under the "root" user'
    3.25 -	print >>sys.stderr, '     (default: ' + gGroup + ')'
    3.26 -	print >>sys.stderr, '  -f'
    3.27 -	print >>sys.stderr, '     Run the command in the foreground.  The logfile option will be'
    3.28 -	print >>sys.stderr, '     ignored and all output will be directed to stdout and stderr.'
    3.29 -	print >>sys.stderr, '  -h, --help'
    3.30 -	print >>sys.stderr, '     Display the command usage information'
    3.31 +    print >>sys.stderr, 'Usage:  ' + sys.argv[0] + ' [OPTIONS]'
    3.32 +    print >>sys.stderr, '  OPTIONS:'
    3.33 +    print >>sys.stderr, '  -p, --httpport'
    3.34 +    print >>sys.stderr, '     The port on which the http server is to listen'
    3.35 +    print >>sys.stderr, '     (default: ' + str( gHttpPort ) + ')'
    3.36 +    print >>sys.stderr, '  -d, --httpdir'
    3.37 +    print >>sys.stderr, '     The directory where the http server is to serve pages from'
    3.38 +    print >>sys.stderr, '     (default: ' + gHttpDir + ')'
    3.39 +    print >>sys.stderr, '  -l, --logfile'
    3.40 +    print >>sys.stderr, '     The file in which to log messages generated by this command'
    3.41 +    print >>sys.stderr, '     (default: ' + gLogFile + ')'
    3.42 +    print >>sys.stderr, '  -u, --user'
    3.43 +    print >>sys.stderr, '     The user under which this command is to run.  This parameter'
    3.44 +    print >>sys.stderr, '     is only used when invoked under the "root" user'
    3.45 +    print >>sys.stderr, '     (default: ' + gUser + ')'
    3.46 +    print >>sys.stderr, '  -g, --group'
    3.47 +    print >>sys.stderr, '     The group under which this command is to run.  This parameter'
    3.48 +    print >>sys.stderr, '     is only used when invoked under the "root" user'
    3.49 +    print >>sys.stderr, '     (default: ' + gGroup + ')'
    3.50 +    print >>sys.stderr, '  -f'
    3.51 +    print >>sys.stderr, '     Run the command in the foreground.  The logfile option will be'
    3.52 +    print >>sys.stderr, '     ignored and all output will be directed to stdout and stderr.'
    3.53 +    print >>sys.stderr, '  -h, --help'
    3.54 +    print >>sys.stderr, '     Display the command usage information'
    3.55  
    3.56  def runServer( aServerPort,
    3.57                 aServerClass  = BaseHTTPServer.HTTPServer,
    3.58                 aHandlerClass = CGIHTTPServer.CGIHTTPRequestHandler ):
    3.59 -	serverAddress = ( '', aServerPort )
    3.60 -	httpd = aServerClass( serverAddress, aHandlerClass )
    3.61 -	httpd.serve_forever( )
    3.62 +    serverAddress = ( '', aServerPort )
    3.63 +    httpd = aServerClass( serverAddress, aHandlerClass )
    3.64 +    httpd.serve_forever( )
    3.65  
    3.66  def daemonize( aHttpDir, aLogFile, aUser, aGroup, aFork = 'true' ):
    3.67 -	# Do some pre-daemon activities
    3.68 -	os.umask( 027 )
    3.69 -	if os.getuid( ) == 0:
    3.70 -		# If we are running as root, we will change that
    3.71 -		uid = pwd.getpwnam( aUser )[2]
    3.72 -		gid = grp.getgrnam( aGroup )[2]
    3.73 +    # Do some pre-daemon activities
    3.74 +    os.umask( 027 )
    3.75 +    if os.getuid( ) == 0:
    3.76 +        # If we are running as root, we will change that
    3.77 +        uid = pwd.getpwnam( aUser )[2]
    3.78 +        gid = grp.getgrnam( aGroup )[2]
    3.79  
    3.80 -		if aFork == 'true':
    3.81 -			# Change the owner of the log file to the user/group
    3.82 -			#   under which the daemon is to run
    3.83 -			flog = open( aLogFile, 'a' )
    3.84 -			flog.close( )
    3.85 -			os.chown( aLogFile, uid, gid )
    3.86 +        if aFork == 'true':
    3.87 +            # Change the owner of the log file to the user/group
    3.88 +            #   under which the daemon is to run
    3.89 +            flog = open( aLogFile, 'a' )
    3.90 +            flog.close( )
    3.91 +            os.chown( aLogFile, uid, gid )
    3.92  
    3.93 -		# Change the uid/gid of the process
    3.94 -		os.setgid( gid )
    3.95 -		os.setuid( uid )
    3.96 +        # Change the uid/gid of the process
    3.97 +        os.setgid( gid )
    3.98 +        os.setuid( uid )
    3.99  
   3.100 -	# Change to the HTTP directory
   3.101 -	os.chdir( aHttpDir )
   3.102 +    # Change to the HTTP directory
   3.103 +    os.chdir( aHttpDir )
   3.104  
   3.105 -	if aFork == 'true':
   3.106 -		# Do first fork
   3.107 -		try:
   3.108 -			pid = os.fork( )
   3.109 -			if pid:
   3.110 -				# Parent process
   3.111 -				return pid
   3.112 +    if aFork == 'true':
   3.113 +        # Do first fork
   3.114 +        try:
   3.115 +            pid = os.fork( )
   3.116 +            if pid:
   3.117 +            # Parent process
   3.118 +                return pid
   3.119  
   3.120 -		except OSError, e:
   3.121 -			raise Exception, e
   3.122 +        except OSError, e:
   3.123 +            raise Exception, e
   3.124  
   3.125 -		# First child process, create a new session
   3.126 -		os.setsid( )
   3.127 +        # First child process, create a new session
   3.128 +        os.setsid( )
   3.129  
   3.130 -		# Do second fork
   3.131 -		try:
   3.132 -			pid = os.fork( )
   3.133 -			if pid:
   3.134 -				# Parent process
   3.135 -				os._exit( 0 )
   3.136 +        # Do second fork
   3.137 +        try:
   3.138 +            pid = os.fork( )
   3.139 +            if pid:
   3.140 +                # Parent process
   3.141 +                os._exit( 0 )
   3.142  
   3.143 -		except OSError, e:
   3.144 -			raise Exception, e
   3.145 +        except OSError, e:
   3.146 +            raise Exception, e
   3.147  
   3.148 -		# Reset stdin/stdout/stderr
   3.149 -		fin  = open( '/dev/null',  'r' )
   3.150 -		flog = open( aLogFile, 'a' )
   3.151 -		os.dup2( fin.fileno( ),  sys.stdin.fileno( ) )
   3.152 -		os.dup2( flog.fileno( ), sys.stdout.fileno( ) )
   3.153 -		os.dup2( flog.fileno( ), sys.stderr.fileno( ) )
   3.154 +        # Reset stdin/stdout/stderr
   3.155 +        fin  = open( '/dev/null',  'r' )
   3.156 +        flog = open( aLogFile, 'a' )
   3.157 +        os.dup2( fin.fileno( ),  sys.stdin.fileno( ) )
   3.158 +        os.dup2( flog.fileno( ), sys.stdout.fileno( ) )
   3.159 +        os.dup2( flog.fileno( ), sys.stderr.fileno( ) )
   3.160  
   3.161  def main( ):
   3.162 -	httpPort = gHttpPort
   3.163 -	httpDir  = gHttpDir
   3.164 -	logFile  = gLogFile
   3.165 -	user     = gUser
   3.166 -	group    = gGroup
   3.167 -	doFork   = 'true'
   3.168 +    httpPort = gHttpPort
   3.169 +    httpDir  = gHttpDir
   3.170 +    logFile  = gLogFile
   3.171 +    user     = gUser
   3.172 +    group    = gGroup
   3.173 +    doFork   = 'true'
   3.174  
   3.175 -	shortOpts = 'd:p:l:u:g:fh'
   3.176 -	longOpts  = [ 'httpdir=', 'httpport=', 'logfile=', 'user=', 'group=', 'help' ]
   3.177 -	try:
   3.178 -		opts, args = getopt.getopt( sys.argv[1:], shortOpts, longOpts )
   3.179 +    shortOpts = 'd:p:l:u:g:fh'
   3.180 +    longOpts  = [ 'httpdir=', 'httpport=', 'logfile=', 'user=', 'group=', 'help' ]
   3.181 +    try:
   3.182 +        opts, args = getopt.getopt( sys.argv[1:], shortOpts, longOpts )
   3.183  
   3.184 -	except getopt.GetoptError, e:
   3.185 -		print >>sys.stderr, e
   3.186 -		usage( )
   3.187 -		sys.exit( )
   3.188 +    except getopt.GetoptError, e:
   3.189 +        print >>sys.stderr, e
   3.190 +        usage( )
   3.191 +        sys.exit( )
   3.192  
   3.193 -	if len( args ) != 0:
   3.194 -		print >>sys.stderr, 'Error: command arguments are not supported'
   3.195 -		usage( )
   3.196 -		sys.exit( )
   3.197 +    if len( args ) != 0:
   3.198 +        print >>sys.stderr, 'Error: command arguments are not supported'
   3.199 +        usage( )
   3.200 +        sys.exit( )
   3.201  
   3.202 -	for opt, opt_value in opts:
   3.203 -		if opt in ( '-h', '--help' ):
   3.204 -			usage( )
   3.205 -			sys.exit( )
   3.206 +    for opt, opt_value in opts:
   3.207 +        if opt in ( '-h', '--help' ):
   3.208 +            usage( )
   3.209 +            sys.exit( )
   3.210  
   3.211 -		if opt in ( '-d', '--httpdir' ):
   3.212 -			httpDir = opt_value
   3.213 +        if opt in ( '-d', '--httpdir' ):
   3.214 +            httpDir = opt_value
   3.215  
   3.216 -		if opt in ( '-p', '--httpport' ):
   3.217 -			try:
   3.218 -				httpPort = int( opt_value )
   3.219 -			except:
   3.220 -				print >>sys.stderr, 'Error: HTTP port is not valid'
   3.221 -				usage( )
   3.222 -				sys.exit( )
   3.223 +        if opt in ( '-p', '--httpport' ):
   3.224 +            try:
   3.225 +                httpPort = int( opt_value )
   3.226 +            except:
   3.227 +                print >>sys.stderr, 'Error: HTTP port is not valid'
   3.228 +                usage( )
   3.229 +                sys.exit( )
   3.230  
   3.231 -		if opt in ( '-l', '--logfile' ):
   3.232 -			logFile = opt_value
   3.233 +        if opt in ( '-l', '--logfile' ):
   3.234 +            logFile = opt_value
   3.235  
   3.236 -		if opt in ( '-u', '--user' ):
   3.237 -			user = opt_value
   3.238 +        if opt in ( '-u', '--user' ):
   3.239 +            user = opt_value
   3.240  
   3.241 -		if opt in ( '-g', '--group' ):
   3.242 -			group = opt_value
   3.243 +        if opt in ( '-g', '--group' ):
   3.244 +            group = opt_value
   3.245  
   3.246 -		if opt in ( '-f' ):
   3.247 -			doFork = 'false'
   3.248 +        if opt in ( '-f' ):
   3.249 +            doFork = 'false'
   3.250  
   3.251 -	pid = daemonize( httpDir, logFile, user, group, doFork )
   3.252 -	if pid > 0:
   3.253 -		sys.exit( )
   3.254 +    pid = daemonize( httpDir, logFile, user, group, doFork )
   3.255 +    if pid > 0:
   3.256 +        sys.exit( )
   3.257  
   3.258 -	runServer( httpPort )
   3.259 +    runServer( httpPort )
   3.260  
   3.261  if __name__ == '__main__':
   3.262 -	main( )
   3.263 +    main( )
     4.1 --- a/xen/arch/x86/hvm/pmtimer.c	Tue Mar 27 09:07:51 2007 -0600
     4.2 +++ b/xen/arch/x86/hvm/pmtimer.c	Tue Mar 27 12:21:48 2007 -0600
     4.3 @@ -27,7 +27,7 @@
     4.4  #define PM1a_EN_ADDR  (ACPI_PM1A_EVT_BLK_ADDRESS + 2)
     4.5  #define TMR_VAL_ADDR  (ACPI_PM_TMR_BLK_ADDRESS)
     4.6  
     4.7 -/* The interesting bit of the PM1a_STS register */
     4.8 +/* The interesting bits of the PM1a_STS register */
     4.9  #define TMR_STS    (1 << 0)
    4.10  #define PWRBTN_STS (1 << 5)
    4.11  #define GBL_STS    (1 << 8)
     5.1 --- a/xen/include/public/hvm/save.h	Tue Mar 27 09:07:51 2007 -0600
     5.2 +++ b/xen/include/public/hvm/save.h	Tue Mar 27 12:21:48 2007 -0600
     5.3 @@ -392,7 +392,7 @@ DECLARE_HVM_SAVE_TYPE(HPET, 12, struct h
     5.4   */
     5.5  
     5.6  struct hvm_hw_pmtimer {
     5.7 -    uint32_t tmr_val;   /* PM_TMR_BLK.TMR_VAL: 24bit free-running counter */
     5.8 +    uint32_t tmr_val;   /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */
     5.9      uint16_t pm1a_sts;  /* PM1a_EVT_BLK.PM1a_STS: status register */
    5.10      uint16_t pm1a_en;   /* PM1a_EVT_BLK.PM1a_EN: enable register */
    5.11  };