亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? layout_g4.c

?? disksim是一個非常優秀的磁盤仿真工具
?? C
字號:
/* diskmodel (version 1.1) * Authors: John Bucy, Greg Ganger * Contributors: John Griffin, Jiri Schindler, Steve Schlosser * * Copyright (c) of Carnegie Mellon University, 2003-2005 * * This software is being provided by the copyright holders under the * following license. By obtaining, using and/or copying this * software, you agree that you have read, understood, and will comply * with the following terms and conditions: * * Permission to reproduce, use, and prepare derivative works of this * software is granted provided the copyright and "No Warranty" * statements are included with all reproductions and derivative works * and associated documentation. This software may also be * redistributed without charge provided that the copyright and "No * Warranty" statements are included in all redistributions. * * NO WARRANTY. THIS SOFTWARE IS FURNISHED ON AN "AS IS" BASIS. * CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER * EXPRESSED OR IMPLIED AS TO THE MATTER INCLUDING, BUT NOT LIMITED * TO: WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY * OF RESULTS OR RESULTS OBTAINED FROM USE OF THIS SOFTWARE. CARNEGIE * MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH * RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT * INFRINGEMENT.  COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE * OF THIS SOFTWARE OR DOCUMENTATION.   */#include "dm.h"#include "layout_g4.h"#include "layout_g4_private.h"static inline int min(int x, int y) {  return x < y ? x : y;}// slipcount(0 and slipcount_rev() are identical except that the former// slides the lbn forward while the latter does not.// optimization: keep track of the points at which the running total// of the slip/spare list is 0.  Have a fast index of those and // start at the highest one <= lbn.// Or:  keep running total and binsearch.// XXX give a succinct explanation as to why ltop() wants the one// and ptol() the other!// This also needs to indicate when lbn coincides with a slip, i.e.// in sequential access, you skip a sector.// Returns the highest entry in the slip list <= lbn??static intslipcount_bins(struct dm_layout_g4 *l,	       int lbn,	       int low,	       int high){  ddbg_assert(low <= high);  ddbg_assert(0 <= low);  ddbg_assert(high <= l->slips_len);  if(high == low+1 || high == low) {    return low;  }  else {    int midpt = low + ((high - low) / 2);    if(l->slips[midpt].off > lbn) {      high = midpt;    }    else {  // off <= lbn      low = midpt;    }    return slipcount_bins(l,lbn,low,high);  }}static int slipcount(struct dm_layout_g4 *l,	  int lbn){  int i;  int ct;  int l2 = lbn;  // the upper limit of l->slips_len is not in error  i = slipcount_bins(l, lbn, 0, l->slips_len);  ddbg_assert(0 <= i);  ddbg_assert(i < l->slips_len);  ct = l->slips[i].count;  while(i < l->slips_len && l->slips[i].off <= l2) {    ct = l->slips[i].count;    l2 = lbn + ct;    i++;  }  return ct;}static int slipcount_rev(struct dm_layout_g4 *l,	      int lbn,	      int *slip_len) {  int i = 0;  // the upper limit of l->slips_len is not in error  i = slipcount_bins(l, lbn, 0, l->slips_len);   ddbg_assert(0 <= i);  ddbg_assert(i < l->slips_len);  if(l->slips[i].off <= lbn      && (i > 0 	 && lbn < l->slips[i].off 	 + (l->slips[i].count - l->slips[i-1].count)))   {    if(slip_len) {      ddbg_assert(0);      // XXX fixme    }    return -1;  }  else {    return l->slips[i].count;  }}struct remap *remap_lbn(struct dm_layout_g4 *l,	  int lbn){  int i;  struct remap *r, *result = 0;  for(i = 0, r = &l->remaps[i]; i < l->remaps_len; i++, r++) {    if(r->off <= lbn && lbn < (r->off + r->count)) {      result = r;      break;    }  }  return result;}// is p the destination of a remap?struct remap *remap_pbn(struct dm_layout_g4 *l,	  struct dm_pbn *p){  int i;  struct remap *r, *result = 0;  for(i = 0, r = &l->remaps[i]; i < l->remaps_len; i++, r++) {    if(r->dest.cyl == p->cyl        && r->dest.head == p->head       && r->dest.sector <= p->sector        && p->sector < (r->dest.sector + r->count))    {      result = r;      break;    }  }  return result;}// Maybe refactor into a single set// of "recurse" routines that take exactly one of a// lbn or pbn and build the path to the tp containing it.voidg4_path_append(struct g4_path *p, 	       union g4_node n, 	       g4_node_t t, 	       int i,	       int quot,	       int resid) {  ddbg_assert(p->length < G4_ALLOC_PATH);  struct g4_path_node *pp = &p->path[p->length];    pp->n = n;  pp->type = t;  pp->i = i;  pp->quot = quot;  pp->resid = resid;  ++p->length;}// For ptol, have to keep track of the size of the enclosing thing so// we don't map past the end of it.struct g4_path *g4_r(struct dm_layout_g4 *l,      union g4_node *n,     g4_node_t t,     int *lbn,     int max,     struct dm_pbn *p,     struct g4_path *acc) // accumlator{  int i;  union g4_node *nn; // where we're going to recurse  g4_node_t tt;  int quot = 0;  int resid = 1;  ddbg_assert(lbn || p);  switch(t) {  case TRACK:    if(lbn) {      if(n->t->low <= *lbn && *lbn <= n->t->high) {	// ?	resid = *lbn - n->t->low;	nn = 0;	goto out;      }      else {	goto out_err;      }    }    else {      if(n->t->low <= p->sector && p->sector <= n->t->high) {	if(p->sector > max) {	  goto out_err;	}	// quot/resid?	resid = p->sector - n->t->low;	 	nn = 0;	goto out;      }      else {	goto out_err;      }    }    break;  case IDX:  {    struct idx_ent *e;    for(i = 0, e = &n->i->ents[0]; i < n->i->ents_len; i++, e++)     {      if(lbn) {	if(e->lbn <= *lbn && *lbn < (e->lbn + e->runlen)) {	  *lbn -= e->lbn;	  quot = *lbn / e->len;	  // XXX	  quot = e->cylrunlen < 0 ? -quot : quot;	  resid = *lbn % e->len;	  nn = &e->child;	  tt = e->childtype;	  *lbn = resid;	  goto out;	}	      }      else {	int low = e->cylrunlen > 0 ? e->cyl : e->cyl + e->cylrunlen + 1;	int high = e->cylrunlen < 0 ? e->cyl : e->cyl + e->cylrunlen - 1;	if(low <= p->cyl && p->cyl <= high	   && (e->childtype != TRACK || p->head == e->head))	{ 	  p->cyl -= e->cyl;	  quot = p->cyl / e->cyllen;	  resid = p->cyl % e->cyllen;	  max = min(max, e->lbn + e->runlen - 1);	  max -= e->lbn;	  // cut down again for RLE	  quot = p->cyl / e->cyllen;	  // XXX	  quot = e->cylrunlen < 0 ? -quot : quot;	  max = min(max, (quot+1) * e->len - 1);	  max -= quot * e->len;	  resid = p->cyl % e->cyllen;	  	  p->cyl = resid;	 	  nn = &e->child;	  tt = e->childtype;	  goto out;	}      }    }    goto out_err;  } break;  default:    ddbg_assert(0);    break;  } out:  g4_path_append(acc, *n, t, i, quot, resid);  if(nn) {    return g4_r(l, nn, tt, lbn, max, p, acc);  }  else {    return acc;  } out_err:  free(acc);  return 0;}struct g4_path *g4_recurse(struct dm_layout_g4 *l, int *lbn, struct dm_pbn *p) {  int lbncopy;  struct dm_pbn pbncopy;  struct g4_path *acc = calloc(1, sizeof(*acc));  union g4_node n;  int max;  if(lbn) {    lbncopy = *lbn;    lbn = &lbncopy;  }  if(p) {    pbncopy = *p;    p = &pbncopy;  }    n.i = l->root;  g4_path_append(acc, n, IDX, 		 0,  // i		 0,  // quot		 1); // resid  max = l->parent->dm_sectors-1;  max += slipcount_rev(l, max, 0);  return g4_r(l, &n, IDX, lbn, max, p, acc);}dm_ptol_result_tltop(struct dm_disk_if *d,     int lbn,      dm_layout_maptype junk,     struct dm_pbn *result,     int *remapsector){  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  struct remap *r;  if(lbn < 0 || d->dm_sectors <= lbn) {    return DM_NX;  }  if((r = remap_lbn(l, lbn))) {    *result = r->dest;    result->sector += (lbn - r->off);    return DM_OK;    // not always -- spare remaps    // return DM_REMAPPED;  }  else {    int i;    struct g4_path *p;    struct g4_path_node *n;    // fiddle lbn according to slips/spares    lbn += slipcount(l, lbn);        p = g4_recurse(l, &lbn, 0);    if(!p) {      return DM_NX;    }    for(i = 0; i < p->length; ++i) {      n = &p->path[i];      switch(n->type) {      case TRACK:	result->sector = n->n.t->low + lbn;	break;	      case IDX:      {	struct idx_ent *e = &n->n.i->ents[n->i];	lbn -= e->lbn;	if(i > 0) {	  result->cyl += e->cyl + (n->quot * e->cyllen);	}	else {	  result->cyl = e->cyl + (n->quot * e->cyllen);	}	if(e->childtype == TRACK) {	  result->head = e->head;	}	lbn = n->resid;      } break;      default: ddbg_assert(0); break;      }    }    free(p);  }  return DM_OK;}dm_ptol_result_tptol(struct dm_disk_if *d,     struct dm_pbn *pbn,     int *remapsector){  int result = 0;  struct dm_pbn pbncopy = *pbn; // we modify this  struct remap *r;  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  pbn = &pbncopy;  if((r = remap_pbn(l, pbn))) {    return r->off + pbn->sector - r->dest.sector;  }  else {    int rv = 0;    int i;    struct g4_path *path;    struct g4_path_node *n;    path = g4_recurse(l, 0, pbn);    if(!path) {      return DM_NX;    }    for(i = 0; i < path->length; ++i) {      n = &path->path[i];      switch(n->type) {      case TRACK:	result += (pbn->sector - n->n.t->low);	break;      case IDX:	{	  struct idx_ent *e = &n->n.i->ents[n->i];	  pbn->cyl -= e->cyl;		  if(i > 0) {	    result += e->lbn + (n->quot * e->len);	  }	  else {	    result = e->lbn + (n->quot * e->len);	  }		  pbn->cyl = n->resid;	  	} break;      default: ddbg_assert(0); break;      }    }    // if result coincides with an entry in the slip list...    rv = slipcount_rev(l, result, NULL); // &slipct    if(rv == -1) {      result = DM_NX;    }    else {      result -= rv;    }    free(path);  }  return result;}static intg4_spt(struct dm_layout_g4 *l,       int *lbn,       struct dm_pbn *pbn){  struct g4_path *p;  struct g4_path_node *n;  int rv;  p = g4_recurse(l, lbn, pbn);  if(p) {    n = &p->path[p->length - 1];    ddbg_assert(n->type == TRACK);    rv = n->n.t->spt;    free(p);  }  else {    rv = -1;  }    return rv;}intg4_spt_lbn(struct dm_disk_if *d,	   int lbn){  int result;  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  struct remap *r;  lbn += slipcount(l,lbn);  r = remap_lbn(l, lbn);  if(r) {    return r->spt;  }  else {    return g4_spt(l, &lbn, 0);  }}intg4_spt_pbn(struct dm_disk_if *d,	   struct dm_pbn *p){  int result;  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  struct remap *r;  if((r = remap_pbn(l, p))) {    return r->spt;  }  else {    return g4_spt(l, 0, p);  }}// I'm punting on what this means for non-whole-track layouts right// now.// This assumes that li ... li+k => (c,h,0) ... (c,h,k-1)dm_ptol_result_tg4_track_bound(struct dm_disk_if *d,	       struct dm_pbn *pbn,	       int *l0,	       int *ln,	       int *remapsector){  int lbn;  struct remap *r;  struct dm_pbn pi;  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  int spt = g4_spt_pbn(d, pbn);  lbn = ptol(d, pbn, 0);  if(lbn < 0) {    return lbn;  }  if(l0) {    pi = *pbn;    pi.sector = 0;    while((*l0 = ptol(d, &pi, 0)) < 0) {      pi.sector++;    }    ddbg_assert(*l0 < d->dm_sectors);  }    if(ln) {    pi = *pbn;    pi.sector = spt-1;        while((*ln = ptol(d, &pi, 0)) < 0) {      pi.sector--;      ddbg_assert(pi.sector >= 0);    }    ddbg_assert(*ln < d->dm_sectors);  }  if (l0 && ln) {    ddbg_assert(*l0 <= *ln);  }  return DM_OK;}dm_angle_tg4_sector_width(struct dm_disk_if *d,		struct dm_pbn *track,		int num){  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  // int spt = g4_spt_pbn(d, track);  dm_angle_t result;  struct remap *r;    if((r = remap_pbn(l, track))) {    result = r->sw;  }  else {    struct g4_path *p;    struct g4_path_node *n;    p = g4_recurse(l, 0, track);    if(!p) {      // DM_NX      result = 0;    }    else {      n = &p->path[p->length - 1];      ddbg_assert(n->type == TRACK);      result = n->n.t->sw;      free(p);    }  }  return result;}// Compute the starting offset of a pbn relative to 0. dm_angle_tg4_skew(struct dm_disk_if *d,	struct dm_pbn *pbn){  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  struct g4_path *p;  struct g4_path_node *n;  int i;  dm_angle_t result;  p = g4_recurse(l, 0, pbn);  if(!p) {     // DM_NX    return 0;   }  for(i = 0; i < p->length; ++i) {    n = &p->path[i];    switch(n->type) {    case TRACK:      result += n->resid * n->n.t->sw;      break;    case IDX:    {      struct idx_ent *e = &n->n.i->ents[n->i];      if(i > 0) {	result += e->off;      }      else {	result = e->off;      }      result += n->quot * e->alen;    } break;          default: ddbg_assert(0); break;    }  }  free(p);  return result;}// convert from an angle to a pbn// returns a ptol_result since provided angle could be in slipped// space, etc.  Rounds angle down to a sector starting offset// Takes the angle in 0l.dm_ptol_result_tg4_atop(struct dm_disk_if *d,	struct dm_mech_state *m,	struct dm_pbn *p){   dm_angle_t sw;  p->cyl = m->cyl;  p->head = m->head;  p->sector = 0; // XXX  sw = g4_sector_width(d, p, 1);  p->sector = m->theta / sw;  // p may be in unmapped space  return d->layout->dm_translate_ptol(d, p, 0);}dm_ptol_result_tg4_defect_count(struct dm_disk_if *d, 		struct dm_pbn *track,		int *result){  // XXX  *result = 0;  return 0;}// XXX These zone apis are totally fake!  We're going to map zones to// root ents.// returns the number of zones for the layoutint g4_get_numzones(struct dm_disk_if *d) {  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  return l->root->ents_len;}intg4_get_zone(struct dm_disk_if *d, int n, struct dm_layout_zone *z){  struct dm_layout_g4 *l = (struct dm_layout_g4 *)d->layout;  struct idx_ent *e;  if(n >= l->root->ents_len) {    return -1;  }  e = &l->root->ents[n];  z->spt = g4_spt_lbn(d, e->lbn);  z->lbn_low = e->lbn;  z->lbn_high = min(d->dm_sectors, e->lbn + e->runlen);  z->cyl_low = e->cyl;  z->cyl_high = min(d->dm_cyls, e->cyl + e->cylrunlen);  return 0;}struct dm_layout_if layout_g4 = {  .dm_translate_ltop = ltop,  .dm_translate_ptol = ptol,  .dm_get_sectors_lbn = g4_spt_lbn,  .dm_get_sectors_pbn = g4_spt_pbn,  .dm_get_track_boundaries = g4_track_bound,   .dm_pbn_skew = g4_skew,  .dm_convert_atop = g4_atop,  .dm_get_sector_width = g4_sector_width,   .dm_defect_count = g4_defect_count,  .dm_get_numzones = g4_get_numzones,  .dm_get_zone = g4_get_zone };

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精彩视频一区二区三区| 久久久久久亚洲综合| 久久99久久久欧美国产| 综合久久久久久| 日韩情涩欧美日韩视频| 91小视频在线| 狠狠久久亚洲欧美| 天堂午夜影视日韩欧美一区二区| 久久精品亚洲乱码伦伦中文| 欧美女孩性生活视频| 成人国产在线观看| 另类中文字幕网| 婷婷国产v国产偷v亚洲高清| 亚洲欧洲精品一区二区三区| 久久只精品国产| 欧美一级黄色大片| 欧美夫妻性生活| 91视频免费观看| 国产a视频精品免费观看| 日本一区中文字幕| 亚洲国产一区二区三区| 中文字幕亚洲成人| 国产精品乱人伦| 欧美精品一区二区三区蜜桃视频| 欧美色成人综合| 在线日韩国产精品| 91免费视频大全| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 视频一区视频二区中文| 中文字幕佐山爱一区二区免费| 2020国产精品自拍| 精品理论电影在线观看 | 日韩欧美在线123| 欧美三级三级三级| 欧美色欧美亚洲另类二区| 91丝袜高跟美女视频| 不卡的电影网站| 成人动漫视频在线| 不卡在线视频中文字幕| 成人国产精品免费观看| 成人免费高清在线观看| 丰满亚洲少妇av| 国产mv日韩mv欧美| 成人国产精品免费观看视频| 成人短视频下载| av电影在线观看不卡| 91论坛在线播放| 欧美中文字幕不卡| 欧美日韩日日夜夜| 97久久精品人人澡人人爽| 日本中文在线一区| 日本人妖一区二区| 蜜桃av一区二区在线观看| 免费观看一级特黄欧美大片| 美女mm1313爽爽久久久蜜臀| 激情欧美一区二区| 成人美女视频在线观看| 94-欧美-setu| 欧美军同video69gay| 日韩一区二区三区精品视频| 日韩欧美亚洲一区二区| 久久久久久影视| 国产精品久久久久桃色tv| 亚洲男人的天堂在线aⅴ视频| 一区二区三区四区国产精品| 五月天婷婷综合| 精品一区二区三区在线播放视频 | 91精品国产色综合久久| 26uuu久久天堂性欧美| 丝袜a∨在线一区二区三区不卡| 久久99精品久久久久| 丰满少妇久久久久久久| 欧美亚洲一区三区| 99精品久久只有精品| 午夜精品久久久久久久| 理论片日本一区| www.欧美日韩| 91精品国产高清一区二区三区 | 一本大道久久a久久综合婷婷| 一本大道av一区二区在线播放| 欧美日韩久久一区二区| 久久久五月婷婷| 亚洲香蕉伊在人在线观| 九一久久久久久| 91视频.com| 日韩一二三区视频| 亚洲免费在线看| 极品尤物av久久免费看| 色综合久久综合中文综合网| 欧美成人bangbros| 亚洲永久免费视频| 国产在线国偷精品免费看| 91成人免费电影| 欧美激情一区二区三区| 日本色综合中文字幕| 波多野结衣中文一区| 日韩欧美一级精品久久| 一区二区三区欧美日| 国内精品久久久久影院色| 欧美性高清videossexo| 久久精品夜夜夜夜久久| 午夜精品久久久久影视| thepron国产精品| 精品美女一区二区| 亚洲国产视频a| 91在线云播放| 国产亚洲精品bt天堂精选| 日韩av中文在线观看| 色域天天综合网| 欧美国产日韩在线观看| 精一区二区三区| 欧美放荡的少妇| 亚洲在线视频网站| 成人99免费视频| 国产日韩欧美精品一区| 天堂成人国产精品一区| 一本色道久久综合亚洲aⅴ蜜桃| 国产亚洲精久久久久久| 精彩视频一区二区| 欧美一区午夜视频在线观看| 一区二区三区 在线观看视频| 99久久精品免费| 中文成人综合网| 国产精品影视在线| 精品乱码亚洲一区二区不卡| 欧美96一区二区免费视频| 欧美日韩不卡视频| 亚洲成人1区2区| 欧美日韩一区二区在线视频| 亚洲精品日韩综合观看成人91| 波多野结衣一区二区三区| 国产精品素人一区二区| 国产v综合v亚洲欧| 国产清纯白嫩初高生在线观看91 | 日韩在线a电影| 91精品国产色综合久久| 福利电影一区二区三区| 国产亚洲综合色| 国产精品一区二区x88av| 久久久精品tv| 成人一区二区三区在线观看| 久久日韩粉嫩一区二区三区| 国产精品伊人色| 国产精品无人区| 99国产精品99久久久久久| 亚洲精品日日夜夜| 欧美天天综合网| 亚洲18色成人| 日韩精品一区二区三区在线观看| 久久激五月天综合精品| 久久久高清一区二区三区| 成人激情开心网| 亚洲激情在线激情| 欧美精品一卡两卡| 国精产品一区一区三区mba视频| 国产婷婷色一区二区三区四区| av中文字幕在线不卡| 亚洲综合偷拍欧美一区色| 337p亚洲精品色噜噜| 国产在线视视频有精品| 欧美激情一区二区三区全黄 | 91在线播放网址| 亚洲第一狼人社区| 日韩欧美久久一区| 国产高清不卡二三区| 亚洲欧美色一区| 911国产精品| 丰满亚洲少妇av| 天涯成人国产亚洲精品一区av| 精品99一区二区三区| 色天使色偷偷av一区二区| 日本中文字幕一区| 国产精品成人在线观看| 欧美一级日韩一级| 成人激情开心网| 蜜桃av噜噜一区二区三区小说| 国产亲近乱来精品视频| 欧美日本视频在线| 国产69精品久久777的优势| 亚洲韩国一区二区三区| 久久综合久久鬼色中文字| 色噜噜狠狠色综合欧洲selulu| 日本伊人午夜精品| 亚洲欧美电影一区二区| 精品福利二区三区| 欧美性三三影院| 粉嫩欧美一区二区三区高清影视| 午夜一区二区三区视频| 国产欧美一区二区精品性色| 欧美亚洲一区三区| 国产乱人伦精品一区二区在线观看| 日韩精品在线一区| 色系网站成人免费| 亚洲一区二区欧美激情| 日本一区二区三区高清不卡| 91成人免费电影| 蜜桃视频在线观看一区二区| 一区二区三区四区中文字幕| 欧美成人女星排行榜| 成人免费三级在线|