@depends(HAS_HDPARM)
def hpa(disks, size=None):
 hpa_data = {}
 for (disk, data) in hdparms(disks, 'N').items():
  (visible, total, status) = data.values()[0]
  if ((visible == total) or ('disabled' in status)):
   hpa_data[disk] = {'total': total}
  else:
   hpa_data[disk] = {'total': total, 'visible': visible, 'hidden': (total - visible)}
 if (size is None):
  return hpa_data
 for (disk, data) in hpa_data.items():
  try:
   size = (data['total'] - int(size))
  except:
   if ('%' in size):
    size = int(size.strip('%'))
    size = ((100 - size) * data['total'])
    size /= 100
  if (size <= 0):
   size = data['total']
  _hdparm('--yes-i-know-what-i-am-doing -Np{0} {1}'.format(size, disk))

@ depends ( HAS_HDPARM ) def hpa ( disks , size = None ) : hpa_data = { } for ( disk , data ) in hdparms ( disks , 'N' ) . items ( ) : ( visible , total , status ) = data . values ( ) [ 0 ] if ( ( visible == total ) or ( 'disabled' in status ) ) : hpa_data [ disk ] = { 'total' : total } else : hpa_data [ disk ] = { 'total' : total , 'visible' : visible , 'hidden' : ( total - visible ) } if ( size is None ) : return hpa_data for ( disk , data ) in hpa_data . items ( ) : try : size = ( data [ 'total' ] - int ( size ) ) except : if ( '%' in size ) : size = int ( size . strip ( '%' ) ) size = ( ( 100 - size ) * data [ 'total' ] ) size /= 100 if ( size <= 0 ) : size = data [ 'total' ] _hdparm ( '--yes-i-know-what-i-am-doing -Np{0} {1}' . format ( size , disk ) )
get/set host protected area settings t13 incits 346-2001 defines the beer and parties .